package com.example.member.controller;

import com.alibaba.nacos.shaded.com.google.common.collect.Maps;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;


@RefreshScope
@RestController
@RequestMapping("/test")
public class TestController {

    @Value("${captcha.width}")
    private int captchaWidth;
    @Value("${captcha.height}")
    private int captchaHeight;

    @Value("${config.url}")
    private String url;

    @GetMapping("/config-list")
    public Map<String, Object> getConfigProp() {
        HashMap<String, Object> retMap = Maps.newHashMap();
        retMap.put("captchaWidth", captchaWidth);
        retMap.put("captchaHeight", captchaHeight);
        return retMap;
    }


    @GetMapping("/refresh-config")
    public Map<String, Object> refreshConfig() {
        HashMap<String, Object> retMap = Maps.newHashMap();
        retMap.put("url", url);
        return retMap;
    }
}
